<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" id="viewport" content="width=device-width, initial-scale=1">
    <title>任务承接</title>
    <link rel="stylesheet" href="../../front/css/common.css">
    <script type="text/javascript" src="../../front/js/jquery.min.js"></script>
    <script type="text/javascript" src="../../front/js/common.js"></script>
</head>
<body style="background: #548EFD">
<div class="ly_header header2">任务承接
    <div class="ly_left goback"><img src="../../front/image/gobackbai.png" alt=""></div>
</div>
<div id="accepttesklistmain" style="margin: 3px">

</div>
</body>
<script type="text/javascript" src="../../front/js/information.js"></script>
<script>
    function accepttesk(data){
        var temp='<div class="accepttesklist mard5">'
                +'<div class="box75 left">'
                    +'<div>'+data.taskName+'</div>'
                    +'<div style="font-size: 0.8em;"><span>任务状态：</span>'
                    switch(data.taskStatus){
                        case 'UN_AUDIT':temp+='<span class="sqshtg padl5 ">申请待审核</span>';
                                break;
                        case 'APPLY_CANCEL':temp+='<span class="sqshtg padl5">申请取消</span>';
                                break;
                        case 'AUDIT_PASS':temp+='<span class="sqshtg padl5">申请审核通过</span>';
                                break;
                        case 'AUDIT_FAIL':temp+='<span class="sqshtg padl5">申请审核不通过</span>';
                                break;
                        case 'TASK_SIGN_UP':temp+='<span class="sqshtg padl5">任务报名中</span>';
                                break;
                        case 'TASK_IN_PROGRESS':temp+='<span class="sqshtg padl5">任务实施进行中</span>';
                                break;
                        case 'TASK_CANCEL':temp+='<span class="sqshtg padl5">任务取消</span>';
                                break;
                        case 'TASK_FINISHED':temp+='<span class="sqshtg padl5">任务结束</span>';
                                break;
                        case 'TASK_APPRECIATED':temp+='<span class="sqshtg padl5">任务已赞赏</span>';
                                break;
                        case 'TASK_ALLOT':temp+='<span class="sqshtg padl5">任务已分配</span>';
                                break;
                    }
                    temp+='</div>'
                    +'<div class="format">报名时间：'+data.createTimeStr+'</div>'
                +'</div>'
                if(data.taskStatus=="TASK_SIGN_UP"){
                    temp+='<div class="box4 left"><img src="../../front/newimg/quxiao.png" class="acceptteskimg canceltask" canceltask="'+data.id+'" alt=""></div>'
                }
                temp+='<div style="clear: both"></div>'
            +'</div>'
        return temp;
    }
    $(function(){
         $.ajax({
             url: "querySignUpTaskList.action",
             type: "post",
             data: {currentPage:1,pageSize:10}, //发送数据,
             dataType: "json",
             success: function(data){
                 var temp=""
                 for(var i=0;i<data.resultList.length;i++){

                     temp+=accepttesk(data.resultList[i])
                 }
                 $("#accepttesklistmain").html(temp)
             },
             error:function(){
                 alert()
             }
         })
    })
    $(document).on("click",".canceltask",function(){
        var id=$(this).attr("canceltask");
        var type="TASK"
        var that=$(this);
        $.ajax({
            url: "../signUp/cancelSignUp.action",
            type: "post",
            data: {entityId:id,entityType:type}, //发送数据,
            dataType: "json",
            async: false,
            success: function(data){
                if(data.success){
                    $(that).remove();
                }

            },
            error:function(){
                alert()
            }
        })
    })
</script>
</html>